#if !defined(TREE_NODE)
#define TREE_NODE
template <class Type>
struct TreeNode{
	typedef void (*Operation)(TreeNode<Type>* node);
	Type data;
	TreeNode* left;
	TreeNode* right;
};

template <class Type>
void PreorderTraverse(TreeNode<Type>*tree,typename TreeNode<Type>::Operation operation){
	if(!tree)return;
	operation(tree);
	PreorderTraverse(tree->left,operation);
	PreorderTraverse(tree->right,operation);
}

template <class Type>
void PostorderTraverse(TreeNode<Type>*tree,typename TreeNode<Type>::Operation operation){
	if(!tree)return;	
	PostorderTraverse(tree->left,operation);
	PostorderTraverse(tree->right,operation);
	operation(tree);
}

template <class Type>
void InorderTraverse(TreeNode<Type>*tree,typename TreeNode<Type>::Operation operation){
	if(!tree)return;	
	InorderTraverse(tree->left,operation);
	operation(tree);
	InorderTraverse(tree->right,operation);	
}


#endif